package com.imooc.girl.util;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MapStuInfo {
    public static void getMapSruInfo(List<Object[]> curr,Map<Object, Object> cur){
        List<Map> resultList = new ArrayList<>();
        for(int i=0;i<curr.size();i++){
            Map<String, Object> map = new HashMap<>();
            for(int j=0;j<curr.get(i).length;j++){
                switch(j){
                    case 0:
                        map.put("name",curr.get(i)[j]);
                        break;
                    case 1:
                        map.put("major",curr.get(i)[j]);
                        break;
                    case 2:
                        map.put("_class",curr.get(i)[j]);
                        break;
                    case 3:
                        map.put("number",curr.get(i)[j]);
                        break;
                    case 4:
                        map.put("sex",curr.get(i)[j]);
                        break;
                    case 5:
                        map.put("tel",curr.get(i)[j]);
                        break;
                    case 6:
                        map.put("nationality",curr.get(i)[j]);
                        break;
                    case 7:
                        map.put("hometown",curr.get(i)[j]);
                        break;
                    case 8:
                        map.put("building",curr.get(i)[j]);
                        break;
                    case 9:
                        map.put("from",curr.get(i)[j]);
                        break;
                }
            }
            resultList.add(map);
        }
        cur.put("students",resultList);
    }
}
